package com.oop.demo09;

//instanceof
public class Application {

    public static void main(String[] args) {
        //类型之间的转化 父  转子、

        //高                  子
        Person student = new Student();
        student.run();

        //student将这个对象转化为Student类型，我们就可以使用Student类型里的方法了
        //调用student类的go
        ((Student) student).go();
    }
}
/*
  Object object = new Student();
        System.out.println(object instanceof Student); //true
        System.out.println(object instanceof Person); //true
        System.out.println(object instanceof Object);//true
        System.out.println(object instanceof Teacher); //false
        System.out.println(object instanceof String); //false

        System.out.println("===================");
        Person person = new Student();
        System.out.println(person instanceof Student);//true
        System.out.println(person instanceof Person);//true
        System.out.println(person instanceof Object);//true
        System.out.println(person instanceof Teacher); //false
        //System.out.println(person instanceof String);
        System.out.println("===================");
        Student student = new Student();
        System.out.println(student instanceof Student);//true
        System.out.println(student instanceof Person);//true
        System.out.println(student instanceof Object);//true
        //System.out.println(student instanceof String);
        //System.out.println(student instanceof Teacher);

 */